//按钮的自定义脚本
cc.Class({
    extends: cc.Component,
    _callback:null,

    properties: {
        selected:{
            default:null,
            type:cc.Node
        }
    },

    onLoad(){
        this.node.on(cc.Node.EventType.TOUCH_START, function (e) {
            this.selected.active=true;
            e.stopPropagation();
            //开始点击的时候
        }.bind(this), this);

        this.node.on(cc.Node.EventType.TOUCH_MOVE, function (e) {
            e.stopPropagation();
            //开始点击的时候
        }.bind(this), this);

        this.node.on(cc.Node.EventType.TOUCH_END, function (e) {
            this.selected.active=false;
            if(this._callback){
                e.stopPropagation();
                this._callback();
            } 
        }.bind(this), this);

        this.node.on(cc.Node.EventType.TOUCH_CANCEL, function (e) {
            this.selected.active=false;
            e.stopPropagation();
        }.bind(this), this);
    },
    // update (dt) {},
});
